package com.dfcj.testservice.controller;


import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class TestController {

    @PreAuthorize("hasAuthority('ROLE_ADMIN')")
    @GetMapping("/demo")
    public String demo(){
        return "hello,oauth2!";
    }

    @GetMapping("/demo2")
    public String demo2(){
        return "hello,no oauth2!";
    }
}
